package com.tian.print.http.interceptor;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * Description: 请求拦截器 <一般是在请求中添加header等等>
 * <br>Author：tian
 * <br>Time: 2019/5/24 14:11
 */
public class RequestInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request()
                .newBuilder()
                .addHeader("accept", "application/json")
                .addHeader("token", "i am token")
                .build();
        return chain.proceed(request);
    }
}
